/**
 * Company : SIANGKLOM.
 * Created By : Chatree Siangklom
 * Created On : Oct 9, 2013  3:59:38 PM 
 * e-Mail : dr_chatree@hotmail.com
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : com.tis.database.services.promis.impl
 * File Name : GlPostingDetailServicesImpl.java
 * TODO
 */
package com.tis.database.services.promis.impl;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.criterion.Criterion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tis.database.dao.promis.GlPostingDetailDao;
import com.tis.database.entitys.promis.GlPostingDetail;
import com.tis.database.entitys.promis.GlPostingDetailPK;
import com.tis.database.entitys.staging.FiCreditNoteOutb;
import com.tis.database.entitys.staging.FiDepositReturnOutb;
import com.tis.database.entitys.staging.FiInvReceiptOutb;
import com.tis.database.entitys.staging.FiInvoiceOutb;
import com.tis.database.services.promis.IGlPostingDetailServices;

/**
 * @author Chatree Siangklom of Administrator
 * Date =Oct 9, 2013 : 3:59:38 PM 
 * CreateBy=Chatree Siangklom
 * 
 * GlPostingDetailServicesImpl
 * TODO
 */
@Service
@Transactional(readOnly=true)
public class GlPostingDetailServicesImpl implements IGlPostingDetailServices {

	@Autowired GlPostingDetailDao glPostingDetailDao;
	
	/** (Javadoc)
	 * @see com.tis.database.services.promis.IGlPostingDetailServices#findById(com.tis.database.entitys.promis.GlPostingDetailPK)
	 * Date =Oct 9, 2013 : 4:03:24 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public GlPostingDetail findById(GlPostingDetailPK id) throws HibernateException {

		return glPostingDetailDao.findById(id);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.IGlPostingDetailServices#findByCriteria(org.hibernate.criterion.Criterion)
	 * Date =Oct 9, 2013 : 4:03:24 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public List<GlPostingDetail> findByCriteria(Criterion criterion) throws HibernateException {

		return glPostingDetailDao.findByCriteria(criterion);
	}
	
	/** (Javadoc)
	 * @see com.tis.database.services.promis.IGlPostingDetailServices#Search(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int)
	 * Date =Oct 9, 2013 : 3:59:54 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	public List<GlPostingDetail> Search(
											String company, 
											String project,
											String voucherType, 
											String voucherSeries, 
											String voucherNumber,
											String glPostingSeqNumber, 
											String syncIsstaging, 
											String syncIssync,
											String unitNumber, 
											String status, 
											String createdOnStart,
											String createdOnEnd, 
											int maxResult) throws HibernateException, Exception {
		
		return glPostingDetailDao.Search(company, project, voucherType, voucherSeries, voucherNumber, glPostingSeqNumber, syncIsstaging, syncIssync, unitNumber, status, createdOnStart, createdOnEnd, maxResult);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.IGlPostingDetailServices#saveOrUpdate(com.tis.database.entitys.promis.GlPostingDetail)
	 * Date =Oct 9, 2013 : 4:03:24 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public void saveOrUpdate(GlPostingDetail e) throws HibernateException {
		glPostingDetailDao.saveOrUpdate(e);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.IGlPostingDetailServices#saveOrUpdate(java.util.List)
	 * Date =Oct 9, 2013 : 4:03:24 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public void saveOrUpdate(List<GlPostingDetail> e) throws HibernateException {
		glPostingDetailDao.saveOrUpdate(e);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.IGlPostingDetailServices#UpdateBackSapMessage(java.util.List)
	 * Date =Oct 15, 2013 : 11:10:25 AM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public List<GlPostingDetail> UpdateBackSapMessageRecv(List<FiInvReceiptOutb> lst) throws HibernateException, Exception {

		return glPostingDetailDao.UpdateBackSapMessageRecv(lst);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.IGlPostingDetailServices#UpdateBackSapMessageInv(java.util.List)
	 * Date =Oct 15, 2013 : 3:00:13 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public List<GlPostingDetail> UpdateBackSapMessageInv(List<FiInvoiceOutb> lst) throws HibernateException, Exception {

		return glPostingDetailDao.UpdateBackSapMessageInv(lst);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.IGlPostingDetailServices#UpdateBackSapMessageCN(java.util.List)
	 * Date =Oct 15, 2013 : 3:00:13 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public List<GlPostingDetail> UpdateBackSapMessageCN(List<FiCreditNoteOutb> lst) throws HibernateException, Exception {
		return glPostingDetailDao.UpdateBackSapMessageCN(lst);
	}

	/** (Javadoc)
	 * @see com.tis.database.services.promis.IGlPostingDetailServices#UpdateBackSapMessageDepo(java.util.List)
	 * Date =Oct 15, 2013 : 3:00:13 PM 
	 * CreateBy=Chatree Siangklom
	 * TODO
	 */
	@Override
	@Transactional(readOnly=false)
	public List<GlPostingDetail> UpdateBackSapMessageDepo(List<FiDepositReturnOutb> lst) throws HibernateException, Exception {
		return glPostingDetailDao.UpdateBackSapMessageDepo(lst);
	}


}
